<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,height=device-height, user-scalable=no,initial-scale=1, minimum-scale=1, maximum-scale=1,target-densitydpi=device-dpi ">
    <title></title>
    <link rel="icon" href="images/jmw.ico"/>
    <link type="text/css" rel="stylesheet" href="css/size.css"/>
    <link type="text/css" rel="stylesheet" href="css/commonality.css"/>
    <link type="text/css" rel="stylesheet" href="css/project.css"/>
    <link type="text/css" rel="stylesheet" href="css/webFreeCall.css"/>
</head>

<body>
<div class="top">
    <div class="logo le">
        <a href="index.html">
            <img src="images/logo.png" alt="">
        </a>
    </div>
    <p class="name"></p>
    <div class="icon_home ri">
        <a href="index.html" title="">
            <img src="images/icon_home.png">
            <span>首页</span>
        </a>
    </div>
</div>

<!--标题-->
<div class="top-names" style="position: relative">
    <p></p>

</div>

<!--公司-->
<div class="company word-detail">
    <div class="company-main"></div>
</div>

<!--内容-->
<div class="introduction mains word-detail">
    <p class="introduce"><span><img src="images/xq_icon2.png">项目简介</span></p>
</div>

<!--加盟详情-->
<div class="content mains  word-detail">
    <p class="introduce"><span><img src="images/xq_icon3.png">加盟详情</span></p>
</div>

<!--盈利分析-->
<div class="analysis mains word-detail">
    <p class="introduce"><span><img src="images/xq_icon4.png">盈利分析</span></p>
</div>

<!--海报页-->
<div class="poster-detail">

</div>

<!--滚动留言-->
<div class="leave-word">
    <div class="leave-word_main">
        <p>郴州市的巴先生：初步打算加入贵公司，请寄资料。</p>
        <p>南通市的关女士：请问我这个地方有加入者了吗？</p>
        <p>重庆市的倪先生：有兴趣开一个店，请寄资料或给我打电话。</p>
        <p>南阳市的弓女士：我加盟你们可以给我详细的资料吗？</p>
        <p>郴州市的巴先生：初步打算加入贵公司，请寄资料。</p>
    </div>
</div>

<!--马上留言-->
<div class="message" id="comment-iframe-write">
    <h4><img src="images/leave.png"/>抓住商机，马上留言</h4>
    <div class="message-main">
        <form id="message">
            <input type="text" name="projectId" value="" class="projectId">
            <p><span>*</span>姓名：<input type="name" name="name" value="" placeholder="如张先生" class="names"/></p>
            <p class="message-name">请输入您的姓名</p>
            <p><span>*</span>电话：<input type="number" name="phone" value="" placeholder="136583665452" class="phone"/>
            </p>
            <p class="message-phone">您输入的电话有误</p>
            <p>
                <span>*</span>内容：<select name="content">
                <option>请问我这个地方有加盟商吗</option>
                <option>想了解加盟细节,请尽快寄一份资料</option>
                <option>想去贵公司考察,请来电话预约时间</option>
                <option>我想加盟,请电话联系我</option>
                <option>我对这个项目感兴趣，请电话联系我</option>
            </select>
            </p>
        </form>
        <input type="submit" value="提交" class="message-sub">
    </div>
</div>

<!--推送-->
<div class="push">
    <div class="title">
        <em class="pub_x"></em>
        <img src="images/icon14.png">
        <span>关注了这个项目的人还关注了</span>
        <em class="pub_x"></em>
    </div>

    <ul>

    </ul>
</div>

<!--页脚-->
<div class="ggy_fd">
    <div class="th tonH" id="phone">
        <img src="images/fd_icon11.png">
        <em>直呼总监</em>
    </div>
    <div class="wyly">
        <a href="#comment-iframe-write">
            <img src="images/fd_icon3.png">我要留言
        </a>
    </div>
    <div class="zxzx">
        <a class="TongbaoMobileChat2" href='#'>
            <img src="images/fd_icon4.png">在线咨询
        </a>
    </div>
</div>

<div id="run_js">

</div>

<!--免费电话-->
<div class="web_freecall_boxs">
    <div class="web-box"></div>
    <div id="web_freecall_box">
        <p>
        <h3>免费呼叫总监</h3>
        </p>
        <p>
            <input type="text" id="web_freecall_phone_input" value="输入电话/手机号码"
                   onmouseover="WebFreeCall.inputMouseOver(this, event);" onmouseout="WebFreeCall.inputMouseOut(this);"
                   onfocus="WebFreeCall.inputKeyDown(this);" onkeyup="WebFreeCall.inputKeyUp(this);"
                   onblur="WebFreeCall.inputBlur(this);"/>
            <button id="web_freecall_call_button"/>
            免费呼叫</button>
        </p>
        <div id="web_freecall_prompt_box"></div>
        <div id="web_freecall_callfomat_box">
            请输入您的联系方式.例如：<br>手机：15800000000<br>固话：01082080372
        </div>
    </div>
</div>

</body>

<script>
    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r;
        i[r] = i[r] || function () {
                (i[r].q = i[r].q || []).push(arguments)
            }, i[r].l = 1 * new Date();
        a = s.createElement(o),
            m = s.getElementsByTagName(o)[0];
        a.async = 1;
        a.src = g;
        m.parentNode.insertBefore(a, m)
    })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-88913818-5', 'auto');
    ga('send', 'pageview');

</script>

<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/webFreeCall.js"></script>

<script>
    var web_freecall_company = 0;
    var web_freecall_itemid = 0;

    window.onload = function () {
        leaveWords();
        getProject(GetQueryString("ID"));
        getProjectRankList(GetQueryString("ID"));
        postComment();
    }

    /**
     * 滚动留言
     */
    function leaveWords() {
        $('.leave-word_main').height(Number($('.leave-word p').length) * 100 + '%')
        var txts = document.getElementsByClassName('leave-word_main').item(0);
        var i = 0;

        function leaveWord() {
            i++
            if (i == $('.leave-word p').length) {
                i = 0
            }
            if (i == 0) {
                txts.style.transition = "0s";
                setTimeout(leaveWord, 0);//延迟执行的函数
            }
            else {
                txts.style.transition = ".5s";
            }
            txts.style.marginTop = -(i * 40) + 'px'
        }

        setInterval(leaveWord, 1000)
    }

    /**
     * 发布留言
     */
    function postComment() {
        $('.names').blur(function () {
            if ($(this).val() == "") {
                $('.message-name').show();
            }
            else {
                $('.message-name').hide();
            }
        })
        $('.phone').blur(function (phone) {
            var reg = /^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/;
            var phone = $('.phone').val();

            console.log(1)
            if (reg.test(phone)) {
                $('.message-phone').hide();
            }
            else {
                $('.message-phone').show();
            }
        })

        $('.message-sub').click(function () {
            var message = $('#message')
            var reg = /^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/;
            $.post(baseUrl + "/api/comment/postComment/", message.serialize(), function (msg) {
                if (msg.code == 100) {
                    $('.message-phone').show().val("请输入正确手机号")
                }
                else if ($('.names').val() == "") {
                    $('.message-name').show();
                }
                else if ($('.phone').val() == "") {
                    $('.message-phone').show();
                }
                else {
                    alert('提交成功')
                    $('.phone').val("")
                    $('.names').val("")
                }
            })
        })


    }

    /**
     * 获取项目详情
     * @param id
     */
    function getProject(id) {
        $.ajax({
            type: "GET",
            url: baseUrl + "/api/project/getProject/?id=" + id,
            dataType: "json",
            success: function (msg) {
                if (msg.code == 500) {
                    window.location.href = "/404"
                }
                $('.projectId').val(msg.data.id);
                var arr = msg.data.major.split(" ");
                var stra = "";
                for (var i = 0; i < arr.length; i++) {
                    if (arr[i] === "") continue;
                    stra += "<em>" + arr[i] + "</em>"
                }
                var projectName = "<p>" + msg.data.name + "</p>";
                //公司介绍
                var Project = "<strong>" + msg.data.name + "</strong> \
				<p>投资金额：<span>" + msg.data.amount + "</span> 总部:<span>" + msg.data.city + "</span></p> \
                <p>" + msg.data.company + "</p> \
                <p class='hei'>品牌标签：<span><img src='images/xq_icon1.png'> " + msg.data.label + "</span></p> \
                <p>主营产品：" + stra + "</p>"
                //项目介绍
                var Introduction = "<p class='text'>" + msg.data.introduction + "</p>"
                //加盟详情
                var getContent = "<p class='text'>" + msg.data.content + "</p>"
                //盈利分析
                var analysis = "<p class='text'>" + msg.data.analysis + "</p>"
                var titles = document.getElementsByTagName("title").item(0);
                titles.innerHTML = msg.data.name;

                var js = msg.data.js;
                $('#run_js').html(js);
                console.log(js);

                if (msg.data.poster != "" && msg.data.poster != null) {
                    projectName += "<a href=\"#\" id='btn-show-way'  onclick='changeShowWay()'>海报页<img src='images/jiantou.png' id='icon-show-way' class='arrow-right'></a>"
                }

                $(".top-names").append(projectName);
                $(".company-main").append(Project);
                $(".introduction").append(Introduction);
                $(".content").append(getContent);
                $(".analysis").append(analysis);
                $(".poster-detail").append(msg.data.poster);
                $(".company").prepend("<img src='" + msg.data.thumb + "' class='banner-img'>")

                web_freecall_company = msg.data.callId;
                web_freecall_itemid = msg.data.id;
                WebFreeCall.init();

            }
        })
    }

    function changeShowWay() {
        if ($(".word-detail").css("display") == "block") {
            $(".word-detail").css("display", "none");
            $(".poster_detail").css("display", "block");
            $("#btn-show-way").html("详情" + "<img src='images/jiantou.png' id='icon-show-way'>");
            $("#btn-show-way").attr("class", "word-right");
            $("#icon-show-way").attr("class", "arrow-left");

        } else {
            $(".word-detail").css("display", "block");
            $(".poster_detail").css("display", "none");
            $("#btn-show-way").html("海报页" + "<img src='images/jiantou.png' id='icon-show-way'>");
            $("#btn-show-way").attr("class", "word-left");
            $("#icon-show-way").attr("class", "arrow-right");
        }
    }

    /**
     * 获取项目排行列表
     * @param id
     */
    function getProjectRankList(id) {
        $.ajax({
            type: "GET",
            url: baseUrl + "/api/project/getProjectRelatedList/?projectId=" + id,
            dataType: "json",
            success: function (msg) {
                var str = "";
                for (var i = 0; i < msg.data.length; i++) {
                    str += RenderProjectItem(msg.data[i]);
                    $('.push ul').html(str);
                }
                $('.push ul').html(str);
            }

        })
    }

    //页脚点击事件
    $('.zxzx').click(function () {
        window.open($('#QIAO_ICON_CONTAINER').attr('href'));
    })
    $('#phone').click(function () {
        $('.web_freecall_boxs').css('display', 'block');
    })
    $('.web-box').click(function () {
        $('.web_freecall_boxs').css('display', 'none');
    })

</script>

<script type="text/javascript">
    var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
    document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fbff2ddba89ed4ec398871a0be83f3111' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="application/javascript">
    document.write("<script type='text/javascript' src='http://zoosnet110001212.emmyma.com/images/9710931_stat/baidubridge'>");
</script>
</html>
